﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AcctrueWMS.Foundation.Common;
using NVelocity.Runtime;

namespace AcctrueWMS.Foundation.Common
{
    /// <summary>
    /// 使用log4net作为velocity的日志记录器
    /// </summary>
    public class VelocityLogger:NVelocity.Runtime.Log.ILogSystem
    {
        public void Init(IRuntimeServices rs)
        {
            
        }

        public void LogVelocityMessage(NVelocity.Runtime.Log.LogLevel level, string message)
        {
            log4net.ILog logger=Common.LoggerManager.GetLogger();
            switch (level)
            {
                case NVelocity.Runtime.Log.LogLevel.Debug:
                    logger.Debug(message);
                    break;
                case NVelocity.Runtime.Log.LogLevel.Error:
                    logger.Error(message);
                    break;
                case NVelocity.Runtime.Log.LogLevel.Info:
                    logger.Error(message);
                    break;
                case NVelocity.Runtime.Log.LogLevel.Warn:
                    logger.Info(message);
                    break;
            }
        }
    }
}
